#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include"button.h"
#include<QLineEdit>
class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
public slots:
    void digitClicke();
    void pointClicked();
    void backSpaceClicked();
    void clear();
    void clearAll();
    void muliplicativeOperatorClicked();
    void additiveOperatorClicked();
    void unaryOperatorClicked();
    void equalClicked();
    void changeClicked();
private:
    Button*createButton(const QString&text,const char *member);
    bool calucate(double rightOperand,const QString&pendingOperator);
    void abortOperator();
private:
    double sumSofar;//结果
    double factorSaFar;//存储临时数据

    QString pendingAdditiveQperator;
    QString pendingMultipcativeOperator;

    bool waitingForOperand;

    QLineEdit*display;//图形化界面
    Button*digitButtons[10];//0-9十个按键
};
#endif // WIDGET_H
